package com.itheima_04;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class MethodTest {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException {
        Class clazz = Class.forName("com.itheima_04.Student");
        Method[] declaredMethods = clazz.getDeclaredMethods();
        for (Method declaredMethod : declaredMethods) {
            System.out.println(declaredMethod);
        }
        System.out.println("----------------------------------" );
        Method show2 = clazz.getMethod("show2",int.class);
        Object o = clazz.newInstance();
        int invoke = (int) show2.invoke(o, 13);
        System.out.println(invoke);



    }
}
